package com.cyd.demo5.listener;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

/**
 * @author keyer
 * Created by cyd on 2021-05-13 18:01:53
 */
@WebListener(value = "oneListener")
public class OneListener implements ServletContextListener {

    /**
     * 监听全局作用域对象的创建
     *
     * @param sce 事件对象
     */
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        System.out.println("OneListener：我创建了");
    }

    /**
     * 监听全局作用域对象的销毁
     *
     * @param sce 事件对象
     */
    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        System.out.println("OneListener：我销毁了");
    }
}
